﻿<UserControl x:Class="SilverlightApplication1.Page"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:SilverlightApplication1" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d">
    <UserControl.Resources>
        <Storyboard x:Name="anims" AutoReverse="False" RepeatBehavior="Forever">
            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="animOne" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)" BeginTime="00:00:00">
                <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
                <SplineDoubleKeyFrame KeyTime="00:00:46.5000000" Value="-1600"/>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="animOne" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)" BeginTime="00:00:00">
                <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
                <SplineDoubleKeyFrame KeyTime="00:00:46.5000000" Value="5"/>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="animTwo" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)" BeginTime="00:00:00">
                <SplineDoubleKeyFrame KeyTime="00:00:10.6000000" Value="0"/>
                <SplineDoubleKeyFrame KeyTime="00:00:47.3000000" Value="-1600"/>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="animTwo" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)" BeginTime="00:00:00">
                <SplineDoubleKeyFrame KeyTime="00:00:10.6000000" Value="0"/>
                <SplineDoubleKeyFrame KeyTime="00:00:47.3000000" Value="10"/>
            </DoubleAnimationUsingKeyFrames>
        </Storyboard>
    </UserControl.Resources>
    <ScrollViewer x:Name="scrlGral" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
        <Grid x:Name="LayoutRoot" ShowGridLines="False" Style="{StaticResource BackGrid}">
            <Grid.RowDefinitions>
                <RowDefinition Height="0.1*"/>
                <RowDefinition Height="*"/>
                <RowDefinition Height="0.1*"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="0.1*"/>
                <ColumnDefinition Width="*" MinWidth="600" MaxWidth="800"/>
                <ColumnDefinition Width="0.1*"/>
            </Grid.ColumnDefinitions>

            <!-- LAYOUTROOT - Row=0 , Column=0 -->
            <!-- PopUp -->
            <Popup x:Name="popUpMessage" Grid.RowSpan="3" Grid.ColumnSpan="4">
                <Grid x:Name="backGround" Background="#10000000"  Margin="0" RenderTransformOrigin="0.5,0.5">
                    <Grid.Resources>
                        <Storyboard x:Name="SBRotate">
                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="Forever" Storyboard.TargetName="PopUpBox" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)">
                                <SplineDoubleKeyFrame KeyTime="00:00:00.6000000" Value="360.361"/>
                            </DoubleAnimationUsingKeyFrames>
                        </Storyboard>
                        <Storyboard x:Name="SBKey" RepeatBehavior="Forever">
                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="Forever" Storyboard.TargetName="recKey" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)">
                                <SplineDoubleKeyFrame KeyTime="00:00:02" Value="358.403"/>
                            </DoubleAnimationUsingKeyFrames>
                        </Storyboard>    
                        <Storyboard x:Name="SBLoad" AutoReverse="True" RepeatBehavior="Forever">
                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="rectangle" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)">
                                <SplineDoubleKeyFrame KeyTime="00:00:02" Value="170"/>
                            </DoubleAnimationUsingKeyFrames>
                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="rectangle" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)">
                                <SplineDoubleKeyFrame KeyTime="00:00:02" Value="358.403"/>
                            </DoubleAnimationUsingKeyFrames>
                        </Storyboard>
                        <Storyboard x:Name="closeMessage">
                            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="backGround" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" BeginTime="00:00:00">
                                <SplineDoubleKeyFrame KeyTime="00:00:00.6000000" Value="0">
                                    <SplineDoubleKeyFrame.KeySpline>
                                        <KeySpline ControlPoint1="0.842999994754791,0" ControlPoint2="0.694000005722046,1"/>
                                    </SplineDoubleKeyFrame.KeySpline>
                                </SplineDoubleKeyFrame>
                            </DoubleAnimationUsingKeyFrames>
                            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="backGround" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)" BeginTime="00:00:00">
                                <SplineDoubleKeyFrame KeyTime="00:00:00.6000000" Value="0">
                                    <SplineDoubleKeyFrame.KeySpline>
                                        <KeySpline ControlPoint1="0.842999994754791,0" ControlPoint2="0.694000005722046,1"/>
                                    </SplineDoubleKeyFrame.KeySpline>
                                </SplineDoubleKeyFrame>
                            </DoubleAnimationUsingKeyFrames>
                            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="backGround" Storyboard.TargetProperty="(UIElement.Opacity)" BeginTime="00:00:00">
                                <SplineDoubleKeyFrame KeyTime="00:00:00.6000000" Value="0.275"/>
                            </DoubleAnimationUsingKeyFrames>
                        </Storyboard>
                        <Storyboard x:Name="openMessage">
                            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="backGround" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" BeginTime="00:00:00">
                                <SplineDoubleKeyFrame KeyTime="00:00:00.6000000" Value="1">
                                    <SplineDoubleKeyFrame.KeySpline>
                                        <KeySpline ControlPoint1="0.842999994754791,0" ControlPoint2="0.694000005722046,1"/>
                                    </SplineDoubleKeyFrame.KeySpline>
                                </SplineDoubleKeyFrame>
                            </DoubleAnimationUsingKeyFrames>
                            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="backGround" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)" BeginTime="00:00:00">
                                <SplineDoubleKeyFrame KeyTime="00:00:00.6000000" Value="1">
                                    <SplineDoubleKeyFrame.KeySpline>
                                        <KeySpline ControlPoint1="0.842999994754791,0" ControlPoint2="0.694000005722046,1"/>
                                    </SplineDoubleKeyFrame.KeySpline>
                                </SplineDoubleKeyFrame>
                            </DoubleAnimationUsingKeyFrames>
                            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="backGround" Storyboard.TargetProperty="(UIElement.Opacity)" BeginTime="00:00:00">
                                <SplineDoubleKeyFrame KeyTime="00:00:00.6000000" Value="1"/>
                            </DoubleAnimationUsingKeyFrames>
                        </Storyboard>
                    </Grid.Resources>

                    <Grid.RenderTransform>
                        <TransformGroup>
                            <ScaleTransform ScaleX="0" ScaleY="0"/>
                            <SkewTransform/>
                            <RotateTransform/>
                            <TranslateTransform/>
                        </TransformGroup>
                    </Grid.RenderTransform>
                    
                    <Grid.RowDefinitions>
                        <RowDefinition Height="auto"/>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="auto"/>
                    </Grid.ColumnDefinitions>

                    <!-- Popup to show exception message -->
                    <Border x:Name="PopUpExcep" Visibility="Collapsed" Style="{StaticResource BackBorderExcep}"
                            Width="200" BorderBrush="DarkRed" BorderThickness="0.5,3,0.5,0.5" 
                            HorizontalAlignment="Center" VerticalAlignment="Center">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="*"/>
                                <RowDefinition Height="2*"/>
                            </Grid.RowDefinitions>
                            <TextBlock x:Name="lblExcep" Grid.Row="0" Margin="5"
                                       MaxWidth="180" TextWrapping="Wrap"
                                       HorizontalAlignment="Center" VerticalAlignment="Bottom"
                                       Text="Error!!" Foreground="Red"/>
                            <Button x:Name="btnExcepClose" Margin="5" Grid.Row="1"
                                    Foreground="Black" Background="Black" Content="Close" 
                                    VerticalAlignment="Center" HorizontalAlignment="Center"
                                    FontSize="10" Height="20" Width="75"
                                    Click="btnCloseMessage_Click">
                            </Button>
                        </Grid>
                    </Border>

                    <!-- Popup to show that is loading the information in the page -->
                    <Border x:Name="PopUpLoading" Visibility="Collapsed" Style="{StaticResource BackBorderLoading}"
                            Width="210" Height="60" Padding="10,10,10,10" CornerRadius="25,25,25,25"
                            HorizontalAlignment="Center" VerticalAlignment="Center">
                        <Canvas>
                            <Rectangle RadiusX="10" RadiusY="10" Style="{StaticResource StrokeRectangle}"
                                HorizontalAlignment="Center" VerticalAlignment="Center"
                                Height="20" Width="190" StrokeThickness="1"/>
                            <Rectangle Height="20" Width="20"
                                RadiusX="20" RadiusY="20" Stroke="Black" StrokeThickness="0.5"
                                x:Name="rectangle" RenderTransformOrigin="0.5,0.5">
                                <Rectangle.Fill>
                                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                        <GradientStop Color="SteelBlue"/>
                                        <GradientStop Color="#FFFFFFFF" Offset="1"/>
                                    </LinearGradientBrush>
                                </Rectangle.Fill>
                                <Rectangle.RenderTransform>
                                    <TransformGroup>
                                        <ScaleTransform/>
                                        <SkewTransform/>
                                        <RotateTransform/>
                                        <TranslateTransform/>
                                    </TransformGroup>
                                </Rectangle.RenderTransform>
                            </Rectangle>
                            <TextBlock x:Name="lblLoading" Canvas.Left="70" Canvas.Top="30" Text="Loading..."/>
                        </Canvas>
                    </Border>

                    <!-- Popup to ask the Amazon Key to be used -->
                    <Border x:Name="PopUpKey" Style="{StaticResource BackBorderKey}" Visibility="Collapsed" 
                            Width="250" Height="170" Padding="10,10,10,10" CornerRadius="25,25,25,25">
                        <StackPanel x:Name="PopUpKeyContent" Height="Auto" Width="Auto"
                                    Orientation="Vertical">
                            <Button x:Name="btnKeyClose" Margin="0,2,2,0"
                                    Foreground="Black" Background="Black"                                    
                                    VerticalAlignment="Top" HorizontalAlignment="Right"
                                    FontSize="7" Visibility="Collapsed"
                                    Click="btnKeyClose_Click">
                                <Button.Content>
                                    <Image Source="images/close.jpg" Height="11" Width="10"/>
                                </Button.Content>
                            </Button>

                            <!-- Amazon SignIn controls -->
                            <Grid x:Name="SignInPopUp" ShowGridLines="False">
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="0.6*"/>
                                    <RowDefinition Height="0.6*"/>
                                    <RowDefinition Height="*"/>
                                    <RowDefinition Height="*"/>
                                    <RowDefinition Height="35"/>
                                </Grid.RowDefinitions>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <TextBlock x:Name="txtAmazonKeyPopUp" Grid.Row="0"
                                           Text="Amazon Key" Foreground="Black" FontSize="11"
                                           HorizontalAlignment="Center" VerticalAlignment="Center"
                                           FontFamily="Verdana" Margin="5"/>
                                <TextBox x:Name="txtKeyPopUp" Grid.Row="1" Width="200"
                                         Margin="5,0,5,0" FontSize="11" FontFamily="Verdana"
                                         KeyDown="txtKey_KeyDown" TextChanged="txtKey_TextChanged"
                                         GotFocus="txtKeyPopUp_GotFocus"/>
                                <HyperlinkButton x:Name="hlkSignInPopUp" Grid.Row="2"
                                                 Foreground="SteelBlue" HorizontalAlignment="Center"
                                                 Content="Sign In" FontFamily="Verdana"  Margin="5"
                                                 Click="hlkSignIn_Click" ClickMode="Press"/>
                                <TextBlock x:Name="txtMsgKeyPopUp" Grid.Row="3"
                                           Text="" Foreground="Red" FontSize="11"                                           HorizontalAlignment="Center" VerticalAlignment="Bottom"
                                           FontFamily="Verdana" Margin="5"/>
                                <Canvas Grid.Row="4" HorizontalAlignment="Left" Background="Transparent">
                                    <Rectangle Height="30" Width="30" Visibility="Collapsed"
                                        RadiusX="30" RadiusY="30" Stroke="Blue" StrokeThickness="1"
                                        x:Name="recKey" RenderTransformOrigin="0.5,0.5"
                                        Canvas.Left="100">
                                        <Rectangle.Fill>
                                            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                                <GradientStop Color="SteelBlue"/>
                                                <GradientStop Color="#FFFFFFFF" Offset="1"/>
                                            </LinearGradientBrush>
                                        </Rectangle.Fill>
                                        <Rectangle.RenderTransform>
                                            <TransformGroup>
                                                <ScaleTransform/>
                                                <SkewTransform/>
                                                <RotateTransform/>
                                            </TransformGroup>
                                        </Rectangle.RenderTransform>
                                    </Rectangle>
                                </Canvas>
                            </Grid>
                        </StackPanel>
                    </Border>

                    <Border x:Name="PopUpBox" Style="{StaticResource BackBorderRadial}"
                            Width="400" Padding="10,10,10,10" CornerRadius="25,25,25,25"
                            Visibility="Collapsed" RenderTransformOrigin="0.5,0.5">
                        <Border.RenderTransform>
                            <TransformGroup>
                                <ScaleTransform/>
                                <SkewTransform/>
                                <RotateTransform/>
                            </TransformGroup>
                        </Border.RenderTransform>
                        <StackPanel x:Name="PopUpBoxContent" Height="Auto" Width="Auto"
                                    Orientation="Vertical">
                            <Button x:Name="btnCloseMessage" Margin="0,2,2,0"
                                    Foreground="Black" Background="Black"                                    
                                    VerticalAlignment="Top" HorizontalAlignment="Right"
                                    FontSize="7" Visibility="Collapsed"
                                    Click="btnCloseMessage_Click">
                                <Button.Content>
                                    <Image Source="images/close.jpg" Height="11" Width="10"/>
                                </Button.Content>
                            </Button>

                            <!-- Result Search - More Info -->
                            <ItemsControl x:Name="icMoreInfoPopUp" Grid.Row="1">
                                <ItemsControl.ItemTemplate>
                                    <DataTemplate>
                                        <StackPanel Orientation="Vertical" Margin="2">
                                            <TextBlock Text="{Binding Title}" FontWeight="Bold" Margin="20,3,3,3"
                                                       MaxWidth="380" TextWrapping="Wrap" HorizontalAlignment="Left"
                                                       FontSize="12"/>

                                            <StackPanel Orientation="Horizontal" Margin="2">
                                                <Image Source="{Binding MediumImage}" Width="140"
                                                   HorizontalAlignment="Left" VerticalAlignment="Center"/>

                                                <StackPanel Orientation="Vertical" Margin="5">
                                                    <TextBlock Text="{Binding Author}" Margin="3,3,3,3"
                                                           MaxWidth="200" TextWrapping="Wrap" HorizontalAlignment="Left"/>
                                                    <StackPanel Orientation="Horizontal" Margin="3,5,3,5">
                                                        <TextBlock Text="("/>
                                                        <TextBlock x:Name="lblRsltMIPublisher" Text="Publisher" FontWeight="Bold" Loaded="ResultSearch_Loaded"/>
                                                        <TextBlock Text=" - "/>
                                                        <TextBlock Text="{Binding Publisher}"
                                                               MaxWidth="150" TextWrapping="Wrap"/>
                                                        <TextBlock Text=")"/>
                                                    </StackPanel>
                                                    <StackPanel Orientation="Horizontal" Margin="3,5,3,5">
                                                        <TextBlock x:Name="lblRsltMIPrice" Text="Price: " FontWeight="Bold" FontSize="12" Loaded="ResultSearch_Loaded"/>
                                                        <TextBlock Text="{Binding ListPrice.CurrencyCode}"/>
                                                        <TextBlock Text=" "/>
                                                        <TextBlock Text="{Binding ListPrice.FormattedPrice}"/>
                                                    </StackPanel>
                                                    <TextBlock x:Name="lblRsltMILwstPrices" Text="Lowest Prices" FontWeight="Bold" Loaded="ResultSearch_Loaded"
                                                               FontSize="12" Margin="15,3,3,0"/>
                                                    <StackPanel Orientation="Horizontal" Margin="25,3,3,3">
                                                        <TextBlock x:Name="lblRsltMILPNew" Text="New: " FontWeight="Bold" Loaded="ResultSearch_Loaded"/>
                                                        <TextBlock Text="{Binding OfferSummary.LowestNewPrice.CurrencyCode}"/>
                                                        <TextBlock Text=" "/>
                                                        <TextBlock Text="{Binding OfferSummary.LowestNewPrice.FormattedPrice}"/>
                                                    </StackPanel>
                                                    <StackPanel Orientation="Horizontal" Margin="25,3,3,3">
                                                        <TextBlock x:Name="lblRsltMILPUsed" Text="Used: " FontWeight="Bold" Loaded="ResultSearch_Loaded"/>
                                                        <TextBlock Text="{Binding OfferSummary.LowestUsedPrice.CurrencyCode}"/>
                                                        <TextBlock Text=" "/>
                                                        <TextBlock Text="{Binding OfferSummary.LowestUsedPrice.FormattedPrice}"/>
                                                    </StackPanel>
                                                    <StackPanel Orientation="Horizontal" Margin="25,3,3,3">
                                                        <TextBlock x:Name="lblRsltMILPCollectible" Text="Collectible: " FontWeight="Bold" Loaded="ResultSearch_Loaded"/>
                                                        <TextBlock Text="{Binding OfferSummary.LowestCollectiblePrice.CurrencyCode}"/>
                                                        <TextBlock Text=" "/>
                                                        <TextBlock Text="{Binding OfferSummary.LowestCollectiblePrice.FormattedPrice}"/>
                                                    </StackPanel>
                                                    <StackPanel Orientation="Horizontal" Margin="3,5,3,5">
                                                        <TextBlock x:Name="lblRsltMIPubDDate" Text="Publication Date " FontWeight="Bold" Loaded="ResultSearch_Loaded"/>
                                                        <TextBlock Text="{Binding PublicationDate}"/>
                                                    </StackPanel>
                                                    <StackPanel Orientation="Horizontal" Margin="3,5,3,5">
                                                        <TextBlock x:Name="lblRsltMIRelDate" Text="Release Date " FontWeight="Bold" Loaded="ResultSearch_Loaded"/>
                                                        <TextBlock Text="{Binding ReleaseDate}"/>
                                                    </StackPanel>
                                                </StackPanel>
                                            </StackPanel>
                                            <StackPanel Orientation="Horizontal" Margin="20,0,3,3">
                                                <TextBlock x:Name="lblRsltMIISBN" Text="ISBN " FontWeight="Bold" Loaded="ResultSearch_Loaded"/>
                                                <TextBlock Text="{Binding Isbn}"/>
                                            </StackPanel>
                                        </StackPanel>
                                    </DataTemplate>
                                </ItemsControl.ItemTemplate>
                            </ItemsControl>
                        </StackPanel>
                    </Border>
                </Grid>
            </Popup>
            <!-- End of PopUp -->
            
            <!--anims-->
            <local:BookControl HorizontalAlignment="Right" Margin="0,139,-495,0" x:Name="animTwo" VerticalAlignment="Top" Width="auto" RenderTransformOrigin="0.5,0.5" Height="auto" Grid.Row="1" Grid.Column="1" Grid.RowSpan="2" >
                <local:BookControl.RenderTransform>
                    <TransformGroup>
                        <ScaleTransform/>
                        <SkewTransform/>
                        <RotateTransform/>
                        <TranslateTransform/>
                    </TransformGroup>
                </local:BookControl.RenderTransform>
            </local:BookControl>
            <local:BookControl Height="auto" HorizontalAlignment="Right" Margin="0,397,-496,0" x:Name="animOne" VerticalAlignment="Top" Width="auto" RenderTransformOrigin="0.5,0.5" Grid.Row="1" Grid.Column="1" Grid.RowSpan="2">
                <local:BookControl.RenderTransform>
                    <TransformGroup>
                        <ScaleTransform/>
                        <SkewTransform/>
                        <RotateTransform/>
                        <TranslateTransform/>
                    </TransformGroup>
                </local:BookControl.RenderTransform>
            </local:BookControl>
            <!-- end of anims -->

            <Border x:Name="BrdLayoutRoot" CornerRadius="10" Background="Transparent" Grid.Row="1" Grid.Column="1"
                    BorderBrush="SteelBlue" BorderThickness="1" Margin="10">

                <Grid x:Name="BaseLayoutRoot" 
                  ShowGridLines="False" Background="Transparent">
                    <Grid.RowDefinitions>
                        <!-- This is fixed to keep the fields aligned of sign in and those of search -->
                        <RowDefinition Height="60"/>
                        <RowDefinition Height="10*"/>
                        <RowDefinition Height="2*"/>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="110"/>
                        <ColumnDefinition Width="500"/>
                        <ColumnDefinition Width="1.2*"/>
                        <ColumnDefinition Width="2*"/>
                    </Grid.ColumnDefinitions>

                    <!-- LAYOUTROOT - Row=0 , Column=0 -->
                    <!-- Amazon SignIn control -->
                    <HyperlinkButton x:Name="hlkSignIn" Foreground="SteelBlue"
                             HorizontalAlignment="Left" VerticalAlignment="Bottom"
                             FontFamily="Verdana" Margin="5,5,5,5"
                             Click="hlkSignInAgain_Click" ClickMode="Press"/>

                    <!-- LayoutRoot - Row=0 , Column=1 -->
                    <TextBox x:Name="txtQuery" Grid.Column="1" Height="20" VerticalAlignment="Bottom" Margin="5"
                     FontFamily="Verdana"
                     KeyDown="txtQueryKeyDown"/>

                    <local:AdvancedSearch x:Name="uctrlAdvSearch" Visibility="Collapsed"
                                  Grid.Column="1" Grid.RowSpan="2" VerticalAlignment="Top"
                                   KeyUp="uctrlAdvSearch_KeyUp"/>

                    <!-- LayoutRoot - Row=0 , Column=2 -->
                    <Button x:Name="btnSearch" Content="Search" Click="Search_Click" Grid.Column="2"
                            Height="20" Width="80" Margin="7,5,5,5" 
                            HorizontalAlignment="Left" VerticalAlignment="Bottom" MaxWidth="100"
                            FontFamily="Verdana" Style="{StaticResource BackButtonSimple}"/>

                    <!-- LayoutRoot - Row=0 , Column=3 -->
                    <Grid x:Name="grdAdvSLenguage" Grid.Column="3">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="130"/><!--Auto-->
                            <ColumnDefinition Width="25"/>
                        </Grid.ColumnDefinitions>
                        <HyperlinkButton x:Name="hlnkAdvSearch" Content="Advanced Search"
                            Click="Advanced" Margin="5"
                            VerticalAlignment="Bottom" HorizontalAlignment="Left"
                            FontFamily="Verdana" Foreground="White"/>
                        <HyperlinkButton x:Name="hlnkEEUU" Click="ChangeLanguage" Margin="3"
                            Grid.Column="1" VerticalAlignment="Bottom">
                        	<Image x:Name="imgEEUU" Source="images/EEUU.jpg"/>
                        </HyperlinkButton>
                        <HyperlinkButton x:Name="hlnkES" Click="ChangeLanguage" Margin="3"
                            Grid.Column="1" VerticalAlignment="Bottom">
                        	<Image x:Name="imgES" Source="images/ES.jpg"/>
                        </HyperlinkButton>
                    </Grid>

                    <!-- LayoutRoot - Row=1 , Column=0 -->
                    <!-- Contains buttons to choose the search option (the option available is Books)-->
                    <Grid x:Name="grdButtons" Grid.Row="1">
                        <Grid.Resources>
                            <Storyboard x:Name="renderBigger" SpeedRatio="2" Duration="00:00:01">
                                <DoubleAnimation Storyboard.TargetProperty="(ScaleTransform.ScaleX)" From="1" To="1.5" Storyboard.TargetName="rdrBooks"/>
                                <DoubleAnimation Storyboard.TargetProperty="(ScaleTransform.ScaleY)" From="1" To="1.5" Storyboard.TargetName="rdrBooks"/>
                            </Storyboard>
                            <Storyboard x:Name="renderLower" SpeedRatio="2" Duration="00:00:01">
                                <DoubleAnimation Storyboard.TargetProperty="(ScaleTransform.ScaleX)" From="1.5" To="1" Storyboard.TargetName="rdrBooks"/>
                                <DoubleAnimation Storyboard.TargetProperty="(ScaleTransform.ScaleY)" From="1.5" To="1" Storyboard.TargetName="rdrBooks"/>
                            </Storyboard>
                            <Storyboard x:Name="SBQuest1" RepeatBehavior="Forever">
                                <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="Forever" Storyboard.TargetName="btnAbout1" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)">
                                    <SplineDoubleKeyFrame KeyTime="00:00:02" Value="358.403"/>
                                </DoubleAnimationUsingKeyFrames>
                            </Storyboard>
                            <Storyboard x:Name="SBQuest2" RepeatBehavior="Forever">
                                <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="Forever" Storyboard.TargetName="btnAbout2" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)">
                                    <SplineDoubleKeyFrame KeyTime="00:00:02" Value="358.403"/>
                                </DoubleAnimationUsingKeyFrames>
                            </Storyboard>
                        </Grid.Resources>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="*" MaxHeight="150"/>
                            <RowDefinition Height="*" MaxHeight="150"/>
                            <RowDefinition Height="*" MaxHeight="150"/>
                            <RowDefinition Height="*"/>
                        </Grid.RowDefinitions>
                        <!-- Books -->
                        <Button x:Name="btnBooks" VerticalAlignment="Center" Margin="2" Width="75" Height="75"
                        FontFamily="Verdana" Click="btnBooks_Click" ClickMode="Press">
                            <Button.RenderTransform>
                                <ScaleTransform x:Name="rdrBooks" ScaleX="1" ScaleY="1" CenterX="30" CenterY="30"/>
                            </Button.RenderTransform>
                            <Button.Clip>
                                <EllipseGeometry x:Name="egBooks" RadiusX="30" RadiusY="30" Center="37.5,37.5"/>
                            </Button.Clip>
                        	<Image x:Name="imgBooks" Source="images/imgLibros.jpg"/>
                        </Button>
                        <!-- About... -->
                        <Button x:Name="btnAbout1" Grid.Row="1" VerticalAlignment="Center" Margin="2"
                                Width="75" Height="75"
                                MouseEnter="btnAbout1BeginRotation" MouseLeave="btnAbout1StopRotation"
                                FontFamily="Verdana" Style="{StaticResource BackButtonSimple}"
                                RenderTransformOrigin="0.5,0.5">
                            <Button.Content>
                                <Image x:Name="imgQuest1" Source="images/Question.jpg"/>
                            </Button.Content>
                            <Button.RenderTransform>
                                <TransformGroup>
                                    <ScaleTransform/>
                                    <SkewTransform/>
                                    <RotateTransform/>
                                </TransformGroup>
                            </Button.RenderTransform>
                            <Button.Clip>
                                <EllipseGeometry x:Name="egAbout1" RadiusX="30" RadiusY="30" Center="37.5,37.5"/>
                            </Button.Clip>
                        </Button>
                        <!-- About... -->
                        <Button x:Name="btnAbout2" Grid.Row="2" VerticalAlignment="Center" Margin="2"
                                Width="75" Height="75"
                                MouseEnter="btnAbout2BeginRotation" MouseLeave="btnAbout2StopRotation"
                                FontFamily="Verdana" Style="{StaticResource BackButton}"
                                RenderTransformOrigin="0.5,0.5">
                            <Button.Content>
                                <Image x:Name="imgQuest2" Source="images/Question.jpg"/>
                            </Button.Content>
                            <Button.RenderTransform>
                                <TransformGroup>
                                    <ScaleTransform/>
                                    <SkewTransform/>
                                    <RotateTransform/>
                                </TransformGroup>
                            </Button.RenderTransform>
                            <Button.Clip>
                                <EllipseGeometry x:Name="egAbout2" RadiusX="30" RadiusY="30" Center="37.5,37.5"/>
                            </Button.Clip>
                        </Button>
                    </Grid>

                    <!-- LayoutRoot - Row=1 , Column=1 -->
                    <Grid x:Name="grdLstResult" ShowGridLines="False" Grid.Column="1" Grid.Row="1">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="30"/>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="30"/>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="2*"/>
                            <!-- Used as margin -->
                            <ColumnDefinition Width="50"/><!--0.2*-->
                            <!-- First page -->
                            <ColumnDefinition Width="50"/><!--0.2*-->
                            <!-- Previous page-->
                            <ColumnDefinition Width="Auto"/>
                            <!-- Pages information -->
                            <ColumnDefinition Width="50"/><!--0.2*-->
                            <!-- Next page -->
                            <ColumnDefinition Width="50"/><!--0.2*-->
                            <!-- Last page -->
                            <ColumnDefinition Width="2*"/>
                            <!-- Used as margin -->
                        </Grid.ColumnDefinitions>
                        <Button x:Name="hlkFPageT" Grid.Column="1" Height="30" Width="30"
                            HorizontalAlignment="Center" Visibility="Collapsed"
                            Click="hlkFPage_Click" ClickMode="Press"
                            MouseEnter="hlkPage_MouseEnter" MouseLeave="hlkPage_MouseLeave">
                            <Button.Clip>
                                <EllipseGeometry RadiusX="8" RadiusY="8" Center="14,17.5"/>
                            </Button.Clip>
                        	<Image x:Name="imgFirstT" Source="images/FirstT.jpg" Height="30"/>
                        </Button>
                        <Button x:Name="hlkPPageT" Grid.Column="2" Height="30" Width="30"
                            HorizontalAlignment="Center" Visibility="Collapsed"
                            Click="hlkPPage_Click" ClickMode="Press"
                            MouseEnter="hlkPage_MouseEnter" MouseLeave="hlkPage_MouseLeave">
                            <Button.Clip>
                                <EllipseGeometry RadiusX="8" RadiusY="8" Center="14,17.5"/>
                            </Button.Clip>
                        	<Image x:Name="imgPreviousT" Source="images/PreviousT.jpg" Height="30"/>
                        </Button>
                        <Button x:Name="hlkNPageT" Grid.Column="4" Height="30" Width="30"
                            HorizontalAlignment="Center" Visibility="Collapsed"
                            Click="hlkNPage_Click" ClickMode="Press"
                            MouseEnter="hlkPage_MouseEnter" MouseLeave="hlkPage_MouseLeave">
                            <Button.Clip>
                                <EllipseGeometry RadiusX="8" RadiusY="8" Center="14,17.5"/>
                            </Button.Clip>
                        	<Image x:Name="imgNextT" Source="images/NextT.jpg" Height="30"/>
                        </Button>
                        <Button x:Name="hlkLPageT" Grid.Column="5" Height="30" Width="30"
                            HorizontalAlignment="Center" Visibility="Collapsed"
                            Click="hlkLPage_Click" ClickMode="Press"
                            MouseEnter="hlkPage_MouseEnter" MouseLeave="hlkPage_MouseLeave">
                            <Button.Clip>
                                <EllipseGeometry RadiusX="8" RadiusY="8" Center="14,17.5"/>
                            </Button.Clip>
                        	<Image x:Name="imgLastT" Source="images/LastT.jpg" Height="30"/>
                        </Button>
                        
                        <TextBlock x:Name="txtPagesInfoT" Grid.Column="3" FontFamily="Verdana"
                           Text=" 1-10 of 95 " Foreground="SteelBlue" VerticalAlignment="Center"
                           Visibility="Collapsed"/>
                        
                        <!-- The items will be loaded on code behind -->
                        <ListBox x:Name="lstResult" Grid.Row="1" Grid.ColumnSpan="7"
                         Margin="5" Visibility="Collapsed" FontFamily="Verdana"
                         SelectionChanged="lstResultSelectionChanged"
                         Width="500" ScrollViewer.HorizontalScrollBarVisibility="Disabled">
                            <ListBox.ItemTemplate>
                                <DataTemplate>
                                    <StackPanel Orientation="Horizontal" >
                                        <Image Source="{Binding Path=MediumImage}" Width="100"
                                       MouseLeftButtonDown="ShowItemInformation"/>

                                        <!-- Info -->
                                        <StackPanel Orientation="Vertical" Width="500"
                                                    Style="{StaticResource SPListBox}" Margin="0,0,5,0">
                                            <TextBlock Text="{Binding Path=Title}" FontWeight="Bold" Margin="3,3,3,3"
                                                       MaxWidth="350" TextWrapping="Wrap"
                                                       HorizontalAlignment="Left"/>
                                            <TextBlock Text="{Binding Path=Author}" Margin="3,3,3,3"
                                                       MaxWidth="350" TextWrapping="Wrap"
                                                       HorizontalAlignment="Left"/>
                                            <StackPanel Orientation="Horizontal" Margin="3,3,3,3">
                                                <TextBlock Text="("/>
                                                <TextBlock x:Name="lblRsltPublisher" Text="Publisher" FontWeight="Bold" Loaded="ResultSearch_Loaded"/>
                                                <TextBlock Text=" - "/>
                                                <TextBlock Text="{Binding Path=Publisher}"
                                                   MaxWidth="300" TextWrapping="Wrap"/>
                                                <TextBlock Text=")"/>
                                            </StackPanel>
                                            <StackPanel Orientation="Horizontal" Margin="3,3,3,3">
                                                <TextBlock x:Name="lblRsltPrice" Text="Price: " FontWeight="Bold" Loaded="ResultSearch_Loaded"/>
                                                <TextBlock Text="{Binding Path=ListPrice.CurrencyCode}"/>
                                                <TextBlock Text=" "/>
                                                <TextBlock Text="{Binding Path=ListPrice.FormattedPrice}"/>
                                            </StackPanel>
                                        </StackPanel>
                                    </StackPanel>
                                </DataTemplate>
                            </ListBox.ItemTemplate>
                        </ListBox>
                        <Button x:Name="hlkFPageB" Grid.Row="2" Grid.Column="1" Height="30" Width="30"
                        HorizontalAlignment="Center" Visibility="Collapsed"
                        Click="hlkFPage_Click" ClickMode="Press"
                        MouseEnter="hlkPage_MouseEnter" MouseLeave="hlkPage_MouseLeave">
                            <Button.Clip>
                                <EllipseGeometry RadiusX="8" RadiusY="8" Center="14,17.5"/>
                            </Button.Clip>
                        	<Image x:Name="imgFirstB" Source="images/First.jpg" Height="30"/>
                        </Button>
                        <Button x:Name="hlkPPageB" Grid.Row="2" Grid.Column="2" Height="30" Width="30"
                        HorizontalAlignment="Center" Visibility="Collapsed"
                        Click="hlkPPage_Click" ClickMode="Press"
                        MouseEnter="hlkPage_MouseEnter" MouseLeave="hlkPage_MouseLeave">
                            <Button.Clip>
                                <EllipseGeometry RadiusX="8" RadiusY="8" Center="14,17.5"/>
                            </Button.Clip>
                        	<Image x:Name="imgPreviousB" Source="images/Previous.jpg" Height="30"/>
                        </Button>
                        <Button x:Name="hlkNPageB" Grid.Row="2" Grid.Column="4" Height="30" Width="30"
                        HorizontalAlignment="Center" Visibility="Collapsed"
                        Click="hlkNPage_Click" ClickMode="Press"
                        MouseEnter="hlkPage_MouseEnter" MouseLeave="hlkPage_MouseLeave">
                            <Button.Clip>
                                <EllipseGeometry RadiusX="8" RadiusY="8" Center="14,17.5"/>
                            </Button.Clip>
                        	<Image x:Name="imgNextB" Source="images/Next.jpg" Height="30"/>
                        </Button>
                        <Button x:Name="hlkLPageB" Grid.Row="2" Grid.Column="5" Height="30" Width="30"
                        HorizontalAlignment="Center" Visibility="Collapsed"
                        Click="hlkLPage_Click" ClickMode="Press"
                        MouseEnter="hlkPage_MouseEnter" MouseLeave="hlkPage_MouseLeave">
                            <Button.Clip>
                                <EllipseGeometry RadiusX="8" RadiusY="8" Center="14,17.5"/>
                            </Button.Clip>
                        	<Image x:Name="imgLastB" Source="images/Last.jpg" Height="30"/>
                        </Button>

                        <TextBlock x:Name="txtPagesInfoB" Grid.Row="2" Grid.Column="3" FontFamily="Verdana"
                           Text=" 1-10 of 95 " Foreground="WhiteSmoke" VerticalAlignment="Center"
                           Visibility="Collapsed" HorizontalAlignment="Center"/>                        
                    </Grid>
                </Grid>
            </Border>
        </Grid>
    </ScrollViewer>
</UserControl>
